﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agenda
{
    public abstract class Observable
    {
        public List<IObserver> ListaObervers;


        public Observable()
        {
            this.ListaObervers = new List<IObserver>();
        }

        public void AgregarOberver(IObserver o)
        {
            this.ListaObervers.Add(o);
        }

        public void EliminarObserver(IObserver o) 
        {
            this.ListaObervers.Remove(o);
        }

        public void NotifyAll()
        {
            foreach (IObserver observer in this.ListaObervers)
            {
                observer.Update(this);
            }
        }
    }
}
